/*
 * Created on 29/06/2006
 *
 */
package ar.com.cubika.trainees.view;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ar.com.cubika.trainees.bean.transportes.Chofer;
import ar.com.cubika.trainees.bean.transportes.Empresa;

public class AgregarChoferServlet extends HttpServlet {
    
    

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    	
    	String nombre =  request.getParameter("nombre");
    	String apellido =  request.getParameter("apellido");
    	String dni = request.getParameter("dni");
    	String cuil =  request.getParameter("cuil");
    	String sexo = request.getParameter("sexo");
    	String edad = request.getParameter("edad");
    	
    	int edadInt;
    	char sexoChar;
    	
    	edadInt = Integer.parseInt(edad);
    	sexoChar = sexo.charAt(0);
    	
        Chofer c = new Chofer(nombre,apellido,dni,edadInt,cuil,sexoChar);
        
        Empresa.addChofer(c);
        
        request.getRequestDispatcher("/viewEmpresa").forward(
                request, response);
        
    }
    
    

}